package com.wzy.orderSystem.util;


import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

public class ConfigManage {
    static ConfigManage configManage = null;
    static Properties properties = null;

    public ConfigManage(String path){
        try {
            properties = new Properties();
            File file = new File(path);
            InputStream fis = new FileInputStream(file);
            properties.load(fis);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static ConfigManage getConfigManage(String path) {
        try{
            if(configManage == null){
                configManage = new ConfigManage(path);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
       return  configManage;
    }

    public static String getValue(String key){
       if(properties != null){
           return properties.getProperty(key);
       }else {
           return "没有该属性";
       }
    }
}
